#include <iostream>
using namespace std;

#include "BitStream.h"

int main()
{
	BitStream bs;
	try
	{
		bs.add(1, 5);
		bs.add(8, 0);
		bs.add(7, 1);
	}
	catch(std::exception &ex)
	{
		cerr << ex.what() << endl;
		return 1;
	}
	// type cast, because of endians -- if you print it byte after byte, then each 8B value will be byte-reversed
	const unsigned char *stream = (const unsigned char *)bs.data();
	for(unsigned int i = 0, im = bs.bytes(); i < im; i++)
		cout << " 0x" << hex << int(stream[i]);
	cout << endl;
	return 0;
}